package com.h6.crm.util.pojo;

public class ErrorR {

    private Integer code;

    private String message;

    private String exception;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getException() {
        return exception;
    }

    public void setException(String exception) {
        this.exception = exception;
    }

    public static ErrorR fail(ResultCode resultCode, Throwable e) {
        ErrorR ErrorR = new ErrorR();
        ErrorR.setCode(resultCode.code());
        ErrorR.setMessage(resultCode.message());
        ErrorR.setException(e.getClass().getName());
        return ErrorR;
    }

    public static ErrorR fail(ResultCode resultCode, Throwable e, String message) {
        ErrorR ErrorR = new ErrorR();
        ErrorR.setCode(resultCode.code());
        ErrorR.setException(e.getClass().getName());
        ErrorR.setMessage(message);
        return ErrorR;
    }

    public static ErrorR fail(Integer code, String message) {
        ErrorR ErrorR = new ErrorR();
        ErrorR.setCode(code);
        ErrorR.setMessage(message);
        return ErrorR;
    }
}
